﻿<html>
<head>
    <script src="~/Scripts/jquery-1.9.1.min.js"></script>
    <script src="~/Scripts/jquery.easyui.min.js"></script>
    <script src="~/Scripts/layer.js"></script>
    <style>
    body {
        text-align: center;
    }

    .div {
        display: inline-block;
        vertical-align: middle;
        margin: 0 auto;
        width: 400px;
        height: 250px;
    }
</style>
    <script type="text/javascript">
        $(document).ready(function () {
                $.ajax({
                    type: 'POST',
                    url:'/MyAdmin/MyAccount',
                    //data: data,
                    success: function (data) {
                        debugger;
                        $("#EditId").val(data.admin1[0].Id);
                        $("#NameYH").val(data.admin1[0].AdminName);
                        $("#PasswordYH").val(data.admin1[0].AdminPassword);
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert("请求失败！");
                    }
                })
        })//显示登陆的用户名密码账号
        function AddAdmin() {//添加用户
            debugger;
            var NameYH = $("#NameYH").val();
            var PasswordYH = $("#PasswordYH").val();
        }
        function ChangeAdmin()//修改用户
        {
            var se=confirm("请选择点击一个按钮!");
            if (se==true)
            {
                debugger;
                var EditId = $("#EditId").val();
                var NameYH = $("#NameYH").val();
                var PasswordYH = $("#PasswordYH").val()
                $.ajax({
                    type: 'POST',
                    url: '/MyAdmin/ChangeName',
                    data: {
                        id:EditId,
                        adminName: NameYH,
                        adminPassword: PasswordYH,
                    },
                    success: function (data) {
                        debugger;
                        alert(data.map);
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert("请求失败！");
                    }
                })
            }
            else
            {
                return;
            }
        }
    </script>

</head>
<body>
    <div id="a">
        <div class="div" align="center">
            <p align="Center">欢迎查看我的账号</p><br />
            用户名: <input type="text" id="NameYH" /><br />
            密&nbsp;&nbsp;码：<input type="text"  id="PasswordYH" /><br /><br />
            <input type="hidden" id="EditId" name="EditId" value="" />
            <div align="center">
                <input type="button" id="Change" onclick="ChangeAdmin()" value="修改密码" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="button" id="" onclick="AddAdmin()" value="添加管理员" />
            </div>
        </div>
    </div>
</body>
</html>